package com.topera.vod.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 读取配置文件的内容
 * InitializingBean spring启动的后执行该类中的方法
 */
@Component
public class ConstantPropertiesUtil implements InitializingBean {

    @Value("${aliyun.vod.file.keyid}")
    private String keyId;

    @Value("${aliyun.vod.file.keysecret}")
    private String keySecret;

    @Value("${spring.servlet.multipart.max-file-size}")
    private String maxFileSize;

    @Value("${spring.servlet.multipart.max-request-size}")
    private String maxRequestSize;



    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String MAX_FILE_SIZE;
    public static String MAX_REQUEST_SIZE;

    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEY_ID = keyId;
        ACCESS_KEY_SECRET = keySecret;
        MAX_FILE_SIZE = maxFileSize;
        MAX_REQUEST_SIZE = maxRequestSize;
    }
}
